
<include file="Share/header" />

    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">留言列表</div>
                        </div>
                        <div class="widget-body  am-fr">

                            <div class="am-u-sm-12">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black j-dataTables" id="example-r">
                                    <thead>
                                        <tr>
                                            <th>姓名</th>
                                            <th>电话</th>
                                            <th>邮箱</th>
                                            <th>地址</th>
                                            <th>内容</th>
                                            <th>留言时间</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                            <volist name="comments_list" id="vo"  >
                                                <tr class="gradeX">
                                                <td>{$vo.username}</td>
                                                <td>{$vo.phone}</td>
                                                <td>{$vo.email}</td>
                                                <td>{$vo.address}</td>
                                                <td>{$vo.content}</td>
                                                <td>{$vo.create_time}</td>
                                                <td>
                                                    <div class="tpl-table-black-operation">
                                                        <a href="javascript:;" class="tpl-table-black-operation-del j-del" data-id="{$vo.id}">
                                                            <i class="am-icon-trash"></i> 删除
                                                        </a>
                                                    </div>
                                                </td>
                                            </tr>
                                        </volist>
                                        
                                        <!-- more data -->
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
      <div class="am-modal-dialog">
        <div class="am-modal-hd">Amaze UI</div>
        <div class="am-modal-bd">
          你，确定要删除这条记录吗？
        </div>
        <div class="am-modal-footer">
          <span class="am-modal-btn" data-am-modal-cancel>取消</span>
          <span class="am-modal-btn" data-am-modal-confirm>确定</span>
        </div>
      </div>
    </div>

    <script type="text/javascript">

        $(document).ready(function(){

          $(".j-dataTables").dataTable();

           // 删除
            $('.j-del').on('click',function(){

                var _id = $(this).data('id');

                $('#my-confirm').modal({

                    relatedTarget: this,

                    onConfirm: function(options) {

                          $.ajax({  

                            url: "del",

                            data:{id: _id},

                            type:'post',

                            success:function(res) {

                                if(res.status == 1){

                                    alert("删除成功！")

                                    window.location.href = '{:U("Comments/index")}';

                                } else {

                                    alert(res.data)

                                }

                            }

                        });

                    },

                    onCancel: function() {

                      // alert('算求，不弄了');

                    }

                  });

            })
        });
    </script>


<include file="Share/footer" />
